<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>诗词</title>
</head>
<body>
    <div class="poetry">
        <h2 class="title">王先堂</h2>
        <h3 class="author">林杰</h3>
        <h4 class="content">深刻</h4>
    </div>
    <script>
        var xhr=new XMLHttpRequest();
        xhr.open('GET','https://api.apiopen.top/recommendPoetry');
        xhr.send();
        xhr.onreadystatechange=function(){
            if(xhr.readyState==XMLHttpRequest.DONE){
                console.log(xhr.responseText);
                var obj=JSON.parse(xhr.responseText);
                console.log(obj.result.title);
                console.log(obj.result.authors);
                console.log(obj.result.content);
            }
                var title=document
                .getElementsByClassName('title')[0];
                title.innerHTML=obj.result.title;
                var author=document.querySelector('.author');
                author.innerHTML=obj.result.authors;
                var content=document.querySelector('.content');
                content.innerHTML=obj.result.content;
            
        }
    </script>
</body>
</html>